
package org.jeecgframework.core.util.clean.bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.jeecgframework.core.util.JSONHelper;

public class HtmlParseResult implements Cloneable{
	
	public static Map<String , String> sfMap = null;
	
	public static List<String> sfList= null;
	
	static{
		sfMap = new HashMap<String ,String>();
		sfMap.put("北京", "北京市");
		sfMap.put("天津", "天津市");
		sfMap.put("上海", "上海市");
		sfMap.put("重庆", "重庆市");
		sfMap.put("河北", "河北省");
		sfMap.put("河南", "河南省");
		sfMap.put("云南", "云南省");
		sfMap.put("辽宁", "辽宁省");
		sfMap.put("黑龙江", "黑龙江省");
		sfMap.put("湖南", "湖南省");
		sfMap.put("安徽", "安徽省");
		sfMap.put("山东", "山东省");
		sfMap.put("新疆", "新疆维吾尔");
		sfMap.put("江苏", "江苏省");
		sfMap.put("浙江", "浙江省");
		sfMap.put("湖北", "湖北省");
		sfMap.put("广西", "广西壮族");
		sfMap.put("甘肃", "甘肃省");
		sfMap.put("山西", "山西省");
		sfMap.put("内蒙", "内蒙古");
		sfMap.put("陕西", "陕西省");
		sfMap.put("吉林", "吉林省");
		sfMap.put("福建", "福建省");
		sfMap.put("贵州", "贵州省");
		sfMap.put("广东", "广东省");
		sfMap.put("青海", "青海省");
		sfMap.put("西藏", "西藏");
		sfMap.put("四川", "四川省");
		sfMap.put("宁夏", "宁夏回族");
		sfMap.put("海南", "海南省");
		sfMap.put("台湾", "台湾省");
		sfMap.put("江西", "江西省");
		sfMap.put("其他", "其他"); 
		
		sfList = new ArrayList<String>();
		
		Iterator<String> keys = sfMap.keySet().iterator();
		String key = null;
		while(keys.hasNext()){
			key = keys.next();
			sfList.add(sfMap.get(key));
		}
	}
	
	
	/**
	 * 地址
	 */
	private String url;
	/**
	 * 标题
	 */
	private String title;
	/**
	 * 字符集
	 */
	private String charset;
	/**
	 * body内容
	 */
	private String bodycontent;
	/**
	 * 全部内容
	 */
	private String allcontent;
	
	private String keyword;
	
	/**
	 * 超链接列表
	 */
	private List<String> hrefList;
	/**
	 * 网站类型
	 */
	private String type;
	/**
	 * 来源
	 */
	private String ly;
	/**
	 * 重点网站
	 */
	private String zdwz;
	/**
	 * IP地址
	 */
	private String ip;
	/**
	 * CDN地址
	 */
	private String address;
	/**
	 * 下一页的地址
	 */
	private String nextPageUrl;
	/**
	 * 身份
	 */
	private String sf;
	/**
	 * 采集站点
	 */
	private String cjzd;
	/**
	 * 站点URL
	 */
	private String site;
	/**
	 * 事件时间
	 */
	private Date eventDate;
	
	/**
	 * 作者
	 */
	private String zz;
	/**
	 * 摘要
	 */
	private String zy;
	/**
	 * 判断重复
	 */
	private String pcfs;
	
	private int maxPage;
	
	/*************************save entity***************************/
	/**
	 * 子网页结果
	 */
	private List<HtmlParseResult> childResultList;
	/**
	 * 视频地址
	 */
	private List<String> videoList;
	/**
	 * 图片地址 
	 */
	private List<String> imageList;
	
	/***************************other attribute***********************/
	
	private Map<String , Object> param;
	
	
	/*************************public method*************************/
	
	public void addParam (String key , Object value){
		if(param == null) param = new HashMap<String,Object>();
		param.put(key, value);
	}
	
	public void addChildResult(HtmlParseResult result){
		if(childResultList == null) childResultList = new ArrayList<HtmlParseResult>();
		childResultList.add(result);
	}
	/**
	 * 
	 * <p>
	 * 方法简要描述: 设置CDN地址时，设置省份
	 * </p>
	 * <p>
	 * 方法详细描述: // TODO
	 * </p>
	 * 
	 * @author LinYingPiaoJian(Q:71426052)
	 * @version 
	 * @see
	 * @param address
	 */
	public void setAddress(String address) {
		this.address = address;
//		Iterator<String> keys = sfMap.keySet().iterator();
//		String key = null;
//		while(keys.hasNext()){
//			key = keys.next();
//			if(address.contains(key)){
//				sf = sfMap.get(key);
//				return ;
//			}
//		}
//		sf = "其他";
	}
	
	
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCharset() {
		return charset;
	}

	public void setCharset(String charset) {
		this.charset = charset;
	}

	public String getBodycontent() {
		return bodycontent;
	}

	public void setBodycontent(String bodycontent) {
		this.bodycontent = bodycontent;
	}

	public String getAllcontent() {
		return allcontent;
	}

	public void setAllcontent(String allcontent) {
		this.allcontent = allcontent;
	}

	public String getPcfs() {
		return pcfs;
	}

	public void setPcfs(String pcfs) {
		this.pcfs = pcfs;
	}

	public List<String> getHrefList() {
		return hrefList;
	}

	public void setHrefList(List<String> hrefList) {
		this.hrefList = hrefList;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getZdwz() {
		return zdwz;
	}

	public void setZdwz(String zdwz) {
		this.zdwz = zdwz;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getAddress() {
		return address;
	}

	public List<HtmlParseResult> getChildResultList() {
		return childResultList;
	}

	public void setChildResultList(List<HtmlParseResult> childResultList) {
		this.childResultList = childResultList;
	}

	public String getNextPageUrl() {
		return nextPageUrl;
	}

	public void setNextPageUrl(String nextPageUrl) {
		this.nextPageUrl = nextPageUrl;
	}

	public Map<String, Object> getParam() {
		return param;
	}

	public void setParam(Map<String, Object> param) {
		this.param = param;
	}

	public String getLy() {
		return ly;
	}

	public void setLy(String ly) {
		this.ly = ly;
	}

	public String getSf() {
		return sf;
	}

	public void setSf(String sf) {
		this.sf = sf;
	}

	public String getCjzd() {
		return cjzd;
	}

	public void setCjzd(String cjzd) {
		this.cjzd = cjzd;
	}

	public String getSite() {
		return site;
	}

	public void setSite(String site) {
		this.site = site;
	}

	

	public Date getEventDate() {
		return eventDate;
	}

	public void setEventDate(Date eventDate) {
		this.eventDate = eventDate;
	}

	public List<String> getVideoList() {
		return videoList;
	}

	public void setVideoList(List<String> videoList) {
		this.videoList = videoList;
	}

	public List<String> getImageList() {
		return imageList;
	}

	public void setImageList(List<String> imageList) {
		this.imageList = imageList;
	}

	public String getZz() {
		return zz;
	}

	public void setZz(String zz) {
		this.zz = zz;
	}

	

	public String getZy() {
		return zy;
	}

	public void setZy(String zy) {
		this.zy = zy;
	}

	public String getKeyword() {
		return keyword;
	}

	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}

	public String toString(){
		return JSONHelper.toJSONString(this);
	}

	public int getMaxPage() {
		return maxPage;
	}

	public void setMaxPage(int maxPage) {
		this.maxPage = maxPage;
	}
	
}
